﻿@using LunwenYun.Infrastructure.Entities.Entity;
@using LunwenYun.Infrastructure.Entities.Enum;
@{
    User user = null;
    if (HttpContext.Current.User.Identity.IsAuthenticated)
    {
        user = new User().Find(HttpContext.Current.User.Identity.Name);
    }

    if (user != null && user.SystemRole == LunwenYun.Infrastructure.Entities.Enum.UserRole.PaperAgent)
    {
        Layout = "~/Views/Shared/_o_Main.cshtml";
    }
    else
    {
        Layout = "~/Views/Shared/_m_Main.cshtml";
    }

    Periodical periodical = ViewBag.Periodical;
    ViewBag.Title = periodical.Name + " - 学术论文云平台";
    ViewBag.Keywords = string.Format("{0},{1},{2},论文发表,职称论文,期刊投稿,论文约稿,学术论文,论文润色", periodical.Name,
        periodical.Name + "投稿", periodical.Name + "润色");
    ViewBag.Description = periodical.Name + "期刊投稿，学术论文云平台为您提供"+ periodical.Name + "期刊可靠的，国内领先的学术论文投稿方案，助力您的论文快速发布";
}
<div class="mini-layout">
    <div class="row-fluid">
        <div class="span9">
            <div class="row-fluid">
                <div class="span3">
                    <div class="book" style="width: 150px;">
                        <img alt="@periodical.Name" src="@periodical.CoverImg" style="width: 150px;" /></div>
                </div>
                <div class="span9">
                    <a>
                        <h4>
                            @periodical.Name 
                            @if (!periodical.IsActive) { 
                                <b style="color:Red;">[未通过审核]</b>
                            }</h4>
                    </a>
                    @if (!String.IsNullOrEmpty(periodical.Name_EN))
                    {
                        <a>@periodical.Name_EN</a>
                    }
                    <hr />
                    @Html.Raw(periodical.Introduction.Replace("\r\n", "<br/>"))
                </div>
            </div>
            <div style="margin-top: 35px; padding-left: 30px;">
                <div class="tabbable">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab1" data-toggle="tab">约稿人</a></li>
                        <li><a href="#tab2" data-toggle="tab">意向稿件</a></li>
                    </ul>
                    <div class="tab-content">
                    <div class="tab-pane active" id="tab1">
                            <table class="table table-hover">
                                <tbody>
                                    @{
                                        List<Agent> agent = ViewBag.Agent;
                                        if (agent != null && agent.Any())
                                        {
                                            foreach (var item in agent)
                                            {
                                        <tr>
                                            <td>
                                                <div class="pull-left">
                                                    <div class="doc">
                                                        <img alt="@item.AgentInfo.Name" src="/content/img/pho.png" /></div>
                                                </div>
                                                <div class="pull-left">
                                                    <h5>
                                                        约稿人： @item.AgentInfo.Name</h5>
                                                    <p>
                                                        <strong>QQ联系：</strong> <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&amp;uin=@item.AgentInfo.QQ&amp;site=qq&amp;menu=yes">
                                                            <img border="0" src="http://wpa.qq.com/pa?p=2:@item.AgentInfo.QQ:41" alt="点击这里给我发消息" title="点击这里给我发消息">
                                                        </a>
                                                        <br />
                                                        <strong>邮件联系：</strong>@item.AgentInfo.Email
                                                        <br />
                                                    </p>
                                                </div>
                                            </td>
                                            <td style="width: 20%; text-align: right" class="center">
                                                @if (user == null || user.SystemRole == UserRole.Member)
                                                {
                                                    <a href="/m/periodicallaunch/@periodical.Id?agent=@item.Id" class="btn btn-mini btn-info">
                                                        联系约稿</a>
                                                }
                                            </td>
                                        </tr>
                                            }
                                        }
                                    }
                                </tbody>
                            </table>
                        </div>
                        <div class="tab-pane" id="tab2">
                            <table class="table table-hover">
                                <tbody>
                                    @{
                                        ItemListBox<Purpose> purpose = ViewBag.Purpose;
                                        if (purpose != null && purpose.Data != null && purpose.Data.Any())
                                        {
                                            foreach (var item in purpose.Data)
                                            {
                                        <tr>
                                            <td>
                                                <div class="pull-left">
                                                    <div class="doc">
                                                        <img alt="doc" src="/content/img/doc.png" /></div>
                                                </div>
                                                <div class="pull-left">
                                                    <h5>
                                                        <a target="_blank" href="/j/article/@item.Id">@item.Article.Title</a></h5>
                                                    <p>
                                                        <strong>分类：</strong>@item.Article.IndType.Mapping() -> @item.Article.SubIndType.Mapping()<br />
                                                        <strong>方向：</strong>
                                                        @if (!String.IsNullOrEmpty(item.Article.Aptitude))
                                                        {
                                                            string aptString = string.Empty;
                                                            List<string> apt = item.Article.Aptitude.Split(';').Where(c => !String.IsNullOrEmpty(c)).ToList();
                                                            foreach (var aptitem in apt)
                                                            {
                                                                try
                                                                {
                                                                    int iapt = Int32.Parse(aptitem);
                                                                    aptString += ((Aptitude)iapt).Mapping() + "、";
                                                                }
                                                                catch { }
                                                            }
                                                            aptString = aptString.EndsWith(";") ?
                                                                aptString.Remove(aptString.Length) : aptString;
                                                            <span>@aptString @item.Article.Language.Mapping()</span><br />
                                                        }
                                                        <strong>预算：</strong>@item.Article.PriceRange
                                                    </p>
                                                </div>
                                            </td>
                                            <td style="width: 20%; text-align: right" class="center">
                                                @if (item.Article.Status == ArticleStatus.Complete)
                                                { 
                                                    <input disabled="disabled" class="btn btn-mini btn-success" value="已完成" />
                                                }
                                                else if (item.Article.ExpireTime < DateTime.Now)
                                                {
                                                    <input disabled="disabled" class="btn btn-mini btn-success" value="已结束" />
                                                }
                                                else
                                                { 
                                                    <a target="_blank" href="/j/article/@item.Id" class="btn btn-mini btn-primary">进行中</a>
                                                }
                                            </td>
                                        </tr>
                                            }
                                        }
                                    }
                                </tbody>
                            </table>
                            @Html.Raw(purpose.PageItemSegment)
                        </div>
                        
                    </div>
                </div>
            </div>
        </div>
        <div class="span3">
            @if (user == null || user.SystemRole == UserRole.Member)
            {
            <div style="text-align: center">
                <a href="/m/submit/@periodical.Id" class="btn btn-primary btn-large" style="width: 55%">
                    我要投稿</a>
            </div>
            }
            @if (user == null || user.SystemRole == UserRole.PaperAgent)
            {
            <div style="text-align: center; padding-top: 5px;">
                <a href="/o/editorApply/@periodical.Id" class="btn btn-info btn-large" style="width: 55%">
                    申请约稿人</a>
            </div>
            }
            <br />
            <div class="mini-layout graybg">
                <table class="table-journal">
                    <tbody>
                        <tr>
                            <td style="width: 75px;" class="right">
                                <a>期刊类型：</a>
                            </td>
                            <td>
                                @{
                                    var apts = periodical.Aptitude.Split(';');
                                    string apt_str = string.Empty;
                                    if (apts != null && apts.Any())
                                    {
                                        foreach (var apt in apts)
                                        {
                                            if (String.IsNullOrEmpty(apt))
                                            {
                                                continue;
                                            }
                                            apt_str += ((Aptitude)Int32.Parse(apt)).Mapping() + " ";
                                        }
                                    }}
                                @apt_str @periodical.Language.Mapping()
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 75px;" class="right">
                                <a>行业：</a>
                            </td>
                            <td>
                                @periodical.IndType.Mapping() @periodical.SubIndType.Mapping()
                            </td>
                        </tr>
                        @if (!String.IsNullOrEmpty(periodical.ZGDW))
                        {
                            <tr>
                                <td class="right">
                                    <a>主管单位：</a>
                                </td>
                                <td>
                                    @periodical.ZGDW
                                </td>
                            </tr>
                        }
                        @if (!String.IsNullOrEmpty(periodical.ZBDW))
                        {
                            <tr>
                                <td class="right">
                                    <a>主办单位：</a>
                                </td>
                                <td>
                                    @periodical.ZBDW
                                </td>
                            </tr>
                        }
                        @if (!String.IsNullOrEmpty(periodical.XBDW))
                        {
                            <tr>
                                <td class="right">
                                    <a>协办单位：</a>
                                </td>
                                <td>
                                    @periodical.XBDW
                                </td>
                            </tr>
                        }
                        @if (!String.IsNullOrEmpty(periodical.CBDW))
                        {
                            <tr>
                                <td class="right">
                                    <a>出版单位：</a>
                                </td>
                                <td>
                                    @periodical.CBDW
                                </td>
                            </tr>
                        }
                        @if (!String.IsNullOrEmpty(periodical.Editor))
                        {
                            <tr>
                                <td class="right">
                                    <a>主 编：</a>
                                </td>
                                <td>
                                    @periodical.Editor
                                </td>
                            </tr>
                        }
                        @if (!String.IsNullOrEmpty(periodical.ISSN_Online))
                        {
                            <tr>
                                <td class="right">
                                    <a>国际刊号：</a>
                                </td>
                                <td>
                                    @periodical.ISSN_Online
                                </td>
                            </tr>
                        }
                        @if (!String.IsNullOrEmpty(periodical.CN_Code))
                        {
                            <tr>
                                <td class="right">
                                    <a>国内刊号：</a>
                                </td>
                                <td>
                                    @periodical.CN_Code
                                </td>
                            </tr>
                        }
                        <tr>
                            <td class="right">
                                <a>出版周期：</a>
                            </td>
                            <td>
                                @periodical.PubRate.Mapping()
                            </td>
                        </tr>
                        @if (!String.IsNullOrEmpty(periodical.Phone))
                        {
                            <tr>
                                <td class="right">
                                    <a>电 话：</a>
                                </td>
                                <td>
                                    @periodical.Phone
                                </td>
                            </tr>
                        }
                        @if (!String.IsNullOrEmpty(periodical.Email))
                        {
                            <tr>
                                <td class="right">
                                    <a>邮 箱：</a>
                                </td>
                                <td>
                                    @periodical.Email
                                </td>
                            </tr>
                        }
                        @if (!String.IsNullOrEmpty(periodical.Address))
                        {
                            <tr>
                                <td class="right">
                                    <a>地 址：</a>
                                </td>
                                <td>
                                    @periodical.Address
                                </td>
                            </tr>
                        }
                        @if (!String.IsNullOrEmpty(periodical.PostNo))
                        {
                            <tr>
                                <td class="right">
                                    <a>邮发代号：</a>
                                </td>
                                <td>
                                    @periodical.PostNo
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
                <hr />
                <table class="table-journal">
                    <tbody>
                        @if (!String.IsNullOrEmpty(periodical.HeXinDescription))
                        {
                        <tr>
                            <td style="width: 75px;" class="right">
                                <a>核心期刊：</a>
                            </td>
                            <td>
                                @Html.Raw(periodical.HeXinDescription)
                            </td>
                        </tr>
                        }
                        @if (!String.IsNullOrEmpty(periodical.Honour))
                        {  
                        <tr>
                            <td style="width: 75px;" class="right">
                                <a>荣誉：</a>
                            </td>
                            <td>
                                @Html.Raw(periodical.Honour)
                            </td>
                        </tr>
                        }
                        @if (!String.IsNullOrEmpty(periodical.Retrieval))
                        {  
                        <tr>
                            <td style="width: 75px;" class="right">
                                <a>收录：</a>
                            </td>
                            <td>
                                @Html.Raw(periodical.Retrieval)
                            </td>
                        </tr>
                        }
                    </tbody>
                </table>
                @*<div class="center">
                    <p>
                        <a class="btn btn-mini" style="width: 65%">更新期刊信息</a></p>
                </div>*@
            </div>
        </div>
    </div>
</div>
